<script>
$(document).ready(function() {
	<?php
	if ($updated == 1) echo 'showNoti("Thuộc tính '.$GLOBALS['product_properties_groups'][$cat].': '.$name.'", "Cập nhập thuộc tính thành công!", "Ok");';
    if ($failed == 1) echo 'showNoti("Thuộc tính '.$GLOBALS['product_properties_groups'][$cat].': '.$name.'", "Cập nhập thuộc tính thất bại!", "Err");';
	if ($GLOBALS['var']['deleted'] != 1) echo 'makeDragOrder("'.$GLOBALS['var']['act'].'");';
	?>    
});
</script>
<?php echo module_open(); ?>
<tr class="no-border">
    <td>
        <input type="hidden" class="tabId" value="<?php echo $GLOBALS['var']['mytab'] ?>" />
        <ul id="myTab" class="nav nav-tabs">
            <?php
            $t = 0;
            foreach ($GLOBALS['product_properties_groups'] as $key => $value)
            {
            	echo '<li class="hide640'.($t == $GLOBALS['var']['mytab'] ? ' active' : '').'" onclick="set_mytab($(this))"><a href="#tabs-'.$t.'" data-toggle="tab">'.$GLOBALS['product_properties_groups'][$key].'</a></li>';
                $t++;
            }
            ?>
            <li class="dropdown active show640">
                <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="current-tab-name"><?php echo $GLOBALS['product_properties_groups']['color'] ?></span> <span class="caret"></span></a>
                <ul class="dropdown-menu">
                <?php
                $i = 0;
                foreach ($GLOBALS['product_properties_groups'] as $key => $value)
                {
                    echo '<li'.($i == $GLOBALS['var']['mytab'] ? ' class="active"' : '').' onclick="set_mytab($(this))"><a href="#tabs-'.$i.'" data-toggle="tab">'.$GLOBALS['product_properties_groups'][$key].'</a></li>';
                    $i++;
                }
                ?>
                </ul>
            </li>
        </ul>
        <div id="myTabContent" class="tab-content">
        <?php
        $t = 0;
        foreach ($GLOBALS['product_properties_groups'] as $key => $value)
        {
        ?>
            <div id="tabs-<?php echo $t ?>" class="tab-pane<?php echo ($t == $GLOBALS['var']['mytab'] ? ' active" ' : '') ?>" data-cat="<?php echo $key ?>">
            	<table cellpadding="0" cellspacing="0" width="100%" border="0">
                    <tr class="nodrop">
                      	<?php if ($GLOBALS['per']['del']) echo '<td class="head center" width="1%"><input type="checkbox" class="checkAll" /></td>'; ?>
                        <td class="head center" width="3%">#</td>
                        <td class="head">Tên thuộc tính</td>
                        <td class="head" width="1%">Kích hoạt</td>
                      	<td class="head center" width="1%">&nbsp;</td>
                    </tr>
                    <?php
                    if(count($tab_product_properties[$key]) && is_array($tab_product_properties[$key]))
                    {
                        $n = 1;
                        foreach ($tab_product_properties[$key] as $data)
                        {
                    ?>
                	<tr class="highlight<?php echo ($data['isnew'] ? ' table-flag-red' : '') ?>" id="<?php echo $data['id'] ?>" name="<?php echo $GLOBALS['product_properties_groups'][$data['cat']] ?> <?php echo $data['name_vn'] ?>">
                        <?php if ($GLOBALS['per']['del']) echo '<td class="fr center">'.sel_item($data['id'], $data['product']).'</td>'; ?>
    					<td class="fr center"><?php echo stt($data['id'], $n++) ?></td>
    					<td class="fr" nowrap="nowrap" height="50px">
    						<?php
    						if ($data['cat'] == 'color')
                            {
    							echo '<span class="seletctColor" style="float: left;"><div><div style="background-color: '.$data['name_vn'].'"></div></div></span>';
    						}
                            else
                            {
    							echo '<span style="float: left;">'.$data['name_vn'].'</span>';
    						}
    						?>
                            &nbsp;<span class="note">(<?php echo $data['product'] ?> sản phẩm)</span>
    					</td>
                        <td class="fr center hide480"><?php echo change_status($data['id'], $data['active'], 'active', 'Kích hoạt', '', '', !$GLOBALS['per']['edit']) ?></td>
    					<td class="fr center" nowrap="nowrap">
    						<?php if ($GLOBALS['per']['edit']) echo edit_alink('', 'javascript:;" onclick="addThuoctinh('.$data['id'].',\''.$data['cat'].'\')') ?>
    						<?php if ($GLOBALS['per']['del']) echo del_restore_link($data['id'], $data['deleted']) ?>	
    					</td>
    				</tr>
                	<?php
                            if ($GLOBALS['per']['add'] || $GLOBALS['per']['edit'])
                            {
                                echo '<input class="textData '.$data['id'].'" data-field="name_vn" value="'.$data['name_vn'].'" />';
                                if ($GLOBALS['cfg']['multi_lang']) echo '<input class="textData '.$data['id'].'" data-field="name_en" value="'.$data['name_en'].'" />';
        					   echo '<input class="textData '.$data['id'].'" data-field="cat" value="'.$data['cat'].'" />';
                            }
                        }
                    }
                    else
                    {
                        echo no_data_mes(5);
                    }
                    ?>
                </table>
            </div>
        <?php
            $t++;
        }
        ?>
        </div>
    </td>
</tr>
<?php echo module_close();
if ($GLOBALS['per']['add'] || $GLOBALS['per']['edit'])
{
?>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <?php
        echo form_open($action, array('id' => 'updateFrm'));
        echo form_input(array('type' => 'hidden', 'name' => 'token', 'value' => $GLOBALS['var']['token']));
        ?>
        <div class="modal-content">
            <div class="modal-body"></div>
            <div class="modal-footer">
                <div id="submitBtn" class="btn btn-success"><i class="icon glyphicons white ok_2"></i><span>Cập nhập</span></div>
                <div class="btn btn-danger" data-dismiss="modal"><i class="icon glyphicons white remove_2"></i><span>Hủy bỏ</span></div>
            </div>
        </div>
        <?php echo form_close(); ?>
    </div>
</div>
<?php
}
?>